This weeks assignment is to make an application that can interface with input/output devices and also to compare them with other application
I will be using LabVIEW to make an application that will interface with my input board made in previous assignment. Our lab is having licensed version of LabVIEW 2013.
Laboratory Virtual Instrument Engineering Workbench (LabVIEW) is a system-design platform and development environment for a visual programming language from National Instruments. The graphical language is named "G"; not to be confused with G-code. Originally released for the Apple Macintosh in 1986, LabVIEW is commonly used for data acquisition, instrument control, and industrial automation on a variety of operating systems (OSs), including Microsoft Windows, various versions of Unix, Linux, and macOS.
From here you can download the evaluation version of LabVIEW if you dont have licensed one
1.LabVIEW
http://ftp.ni.com/support/softlib/visa/NI-VISA/15.0.1/NIVISA1501full_downloader.exeNI-VISA is a software API that greatly reduces the development time of test and measurement systems. It gives developers the ability to easily create code to communicate with any instrument, over any bus, on most operating systems in use today. It also allows the generation of code that can be moved from one platform to another or from one bus type to another with little or no overhead in the change. This opens the door for creating hybrid systems that make the best and most cost effective use of multiple bus types all used in one test system.
To know more about NI VISA click here
3. USB to serial converter
To know about serial communication in LabVIEW you can go through tutorial given here
Below you can find the test code to check the serial communication using LabVIEW. In this code serial monitor will always display zero but in case 1 is given as input it will display one
#include
const byte rxPin = 3;
const byte txPin= 4;
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
// define pin modes for tx, rx:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
// the loop function runs over and over again forever
void loop() {
//listen to serial port
if (mySerial.read()=='1')
{
mySerial.println("one");
delay(1000);
}
else
{
mySerial.println("zero");
delay(1000);
}
}
After installing the labVIEW just open a new VI. After this move to control panel. Now in LabVIEW you have to just pick and place all the icons from library to block diagram. A snapshot of the steps taken to collect all the icons from library are shown below. Now just collect the blocks one by one and place it on blockdiagram. After arranging them in proper sequence connect them using wires.
This icon initailzes the serial port specified by VISA resource terminal according to the settings given through its terminal.
This write the data from write buffer terminal.
Reads the specified number of bytes from the device or interface specified by VISA.
Closes a device session or event object specified by VISA resource name
This is the front panel of the application that is developed in LabVIEW.It has read buffer window from where you can read the serial data, write buffer to write data on serial window. It has delay knob from where we can change the delay between read and write operation. It also has stop button to stop the VI
This is the coding part of the application that is done in LabVIEW
For this i will be using my board developed in input devices for Sharp IR sensor. The board is connected to my laptop through FTDI connector.
Next i tried the processing with the bridge board fabricated in the previous assignment.
I downloaded the processing platform from the link given here
I followed the processing tutorial page and the vedios available globally.
Below you can find the code that is burned using Arduino IDE.
#include
SoftwareSerial mySerial =SoftwareSerial(3,4);
char val; // Data received from the serial port
int ledPin =0; // Set the pin to digital I/O 13
void setup()
{
pinMode(ledPin, OUTPUT); // Set pin as OUTPUT
mySerial.begin(9600);// Start serial communication at 9600 bps
}
void loop()
{
if (mySerial.available())
{
// If data is available to read,
val = mySerial.read(); // read it and store it in val
}
if (val == '1')
{
// If 1 was received
digitalWrite(ledPin, HIGH); // turn the LED on
}
else
{
digitalWrite(ledPin, LOW); // otherwise turn it off
}
delay(10); // Wait 10 milliseconds for next reading
}
This board has a LED connected to PIN 0. I used Arduino IDE to upload the program. According to the logic given LED will turn ON wheb serial read =1 and it will turn OFF hen serial read =0